<%-- 
    Document   : ExaminationList
    Created on : 14-dic-2011, 14.36.44
    Author     : guybrush
--%>

<%@ page pageEncoding="UTF-8" %>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j"%>
<%@taglib prefix="rich" uri="http://richfaces.org/rich"%>

<a4j:form id="tableE">
    <rich:extendedDataTable id="visite" value="#{extendedDataTableBean.examinationsDataModel}" var="ex"
                            width="650px" height="290px" selectionMode="single" rows="7" footerClass="ds"
                            selection="#{extendedDataTableBean.selectionExam}" columnClasses="b2,b2,b2,b2,b2,b2" >
        <f:facet name="header">
            <h:outputText value="#{msg.examinations}" />
        </f:facet>
        <rich:column sortBy="#{ex.id}">
            <f:facet name="header">
                <h:outputText value="Id" />
            </f:facet>
            <h:outputText value="#{ex.id}" />
        </rich:column>
        <rich:column sortBy="#{ex.tipo}">
            <f:facet name="header">
                <h:outputText value="#{msg.type}" />
            </f:facet>
            <rich:inplaceSelect defaultLabel="#{msg.charters_slide}"
                                    value="#{ex.tipo}" editEvent="none">
                <f:selectItem itemValue="1" itemLabel="#{msg.prog_exam}" />
                <f:selectItem itemValue="2" itemLabel="#{msg.vaccination}" />
                <f:selectItem itemValue="3" itemLabel="#{msg.voluntary}" />
            </rich:inplaceSelect>
        </rich:column>
        <rich:column sortBy="#{ex.scadenza}">
           <f:facet name="header">
               <h:outputText value="#{msg.expirationDate}" />
           </f:facet>
           <h:outputText value="#{ex.scadenza}">
               <f:convertDateTime type="date" dateStyle="long" />
           </h:outputText>
        </rich:column>
        <rich:column id="cent-style" sortBy="#{ex.tipo_scadenza}">
            <f:facet name="header">
                <h:outputText value="#{msg.expirationType}" />
            </f:facet>
            <rich:inplaceSelect defaultLabel="#{msg.charters_slide}"
                                value="#{ex.tipo_scadenza}" editEvent="none">
                <f:selectItem itemValue="1" itemLabel="#{msg.periodic}" />
                <f:selectItem itemValue="2" itemLabel="#{msg.prog_med}" />
                <f:selectItem itemValue="3" itemLabel="#{msg.prog_bd}" />
            </rich:inplaceSelect>
        </rich:column>
        <rich:column sortBy="#{ex.descrizione}">
            <f:facet name="header">
                <h:outputText value="#{msg.description}" />
            </f:facet>
            <h:outputText value="#{ex.descrizione}" />
        </rich:column>
        <rich:column filterExpression="#{extendedDataTableBean.performedF==ex.effettuata}">
            <f:facet name="header">
                <h:panelGroup>
                <h:selectBooleanCheckbox id="performedF" value="#{extendedDataTableBean.performedF}">
                    <a4j:support reRender="tableE" id="performedFiltering" event="onchange"/>
                </h:selectBooleanCheckbox>
                <h:outputText value="  #{msg.performed}" />
                </h:panelGroup>
            </f:facet>
            <h:selectBooleanCheckbox id="performed" value="#{ex.effettuata}" disabled="true"/>
        </rich:column>
        <f:facet name="footer">
            <rich:datascroller id="ds" for="visite"></rich:datascroller>
        </f:facet>
        <a4j:support reRender="examEdit" id="examinations_detail"
                     event="onselectionchange"
                     action="#{extendedDataTableBean.takeExamSelection()}" />
    </rich:extendedDataTable>
</a4j:form>